package com.tueye.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.tueye.base.util.BaseDao;
import com.tueye.base.util.IBaseHbnDao;
import com.tueye.base.util.Page;
import com.tueye.dao.IAdsiteDao;
import com.tueye.dao.IArticleDao;
import com.tueye.entity.Admin;
import com.tueye.entity.Adsite;
import com.tueye.entity.ArticleTopic;
import com.tueye.entity.TopicType;
/**
 * 
 * @author hanxiaowei
 *
 */
@Scope("prototype")
@Component("articleDao")
public class ArticleDaoImpl extends BaseDao implements IArticleDao{
	
	@Autowired
	@Qualifier("baseHbnDao")
	private IBaseHbnDao  baseHbnDao;

	@Override
	public Page pagedQueryByHQL(String hql, int pageNo, int pageSize,
			Object... values) {
		return baseHbnDao.pagedQueryByHQL(hql, pageNo, pageSize, values);
	}

	@Override
	public List<ArticleTopic> getArticleByHql(String hql) {
		return baseHbnDao.queryList(hql);
	}

	@Override
	public void addArticle(ArticleTopic article) {
		// TODO Auto-generated method stub
		baseHbnDao.saveOrUpdate(article);
	}

	@Override
	public ArticleTopic getArticleById(String id) {
		// TODO Auto-generated method stub
		return (ArticleTopic) baseHbnDao.findById(ArticleTopic.class, id);
	}

	@Override
	public void delArticle(String id) {
		// TODO Auto-generated method stub
		ArticleTopic article =  (ArticleTopic) baseHbnDao.findById(ArticleTopic.class, id);
		baseHbnDao.delete(article);
	}
	

}
